import { CreateNoticeItem, NoticePageParam, TabItem } from './model/noticeModel';
import { noticeHttp } from '/@/utils/http/axios';
enum Api {
  GET_NOTICE_LIST = '/notice-list/getList',
  CREATE_NEW_NOTICE = 'notice-list/create',
}

export const getNoticeList = () => {
  return noticeHttp.get<TabItem[]>({ url: Api.GET_NOTICE_LIST });
};

export const createNotice = async (params: NoticePageParam) => {
  const res = await noticeHttp.post<CreateNoticeItem>({
    url: Api.CREATE_NEW_NOTICE,
    params,
  });
  if (res.message != 'error') {
    return getNoticeList();
  }
};
